/**
 * 意见反馈信息JS
 * @author Assassin
 */
// 删除意见反馈信息
function deleteSuggestion(suggestionId) {
    layer.msg('确定删除该信息？', {
        time: 0,
        btn: ['确定', '取消'],
        yes: function (index) {
            layer.close(index);
            // 提交删除
            shiro.ajax({
                url: 'suggestion/delete',
                data: {"suggestionId": suggestionId},
                success: function (data) {
                    if (data.result == 0) {
                        layer.msg(data.message, {icon: 1, time: 1000}, function () {
                            window.location.href = shiro.baseUrl + "suggestion/list";
                        });
                    } else {
                        layer.msg(data.message, {icon: 5, time: 1000});
                    }
                }
            });
        }
    });
}

// 批量删除意见反馈信息
function batchDeleteSuggestion() {
    var suggestionIdArray = shiro.form.getCheckBoxSelectValues('suggestionIdCheckBox');
    if (suggestionIdArray.length == 0) {
        layer.msg('请选择要操作的数据行', {icon: 5, time: 1000});
    } else {
        layer.msg('确定删除选中的信息？', {
            time: 0,
            btn: ['确定', '取消'],
            yes: function (index) {
                layer.close(index);
                var suggestionIds = suggestionIdArray.join(',');
                // 提交删除
                shiro.ajax({
                    url: 'suggestion/batchDelete',
                    data: {"suggestionIds": suggestionIds},
                    success: function (data) {
                        if (data.result == 0) {
                            layer.msg(data.message, {icon: 1, time: 1000}, function () {
                                window.location.href = shiro.baseUrl + "suggestion/list";
                            });
                        } else {
                            layer.msg(data.message, {icon: 5, time: 1000});
                        }
                    }
                });
            }
        });
    }
}

// 查看意见反馈信息
function viewSuggestion(suggestionId) {
    layer.open({
        type: 2,
        title: '意见反馈',
        area: ['600px', '400px'],
        shade: 0.8,
        closeBtn: 1,
        shadeClose: true,
        content: shiro.baseUrl + 'suggestion/view/' + suggestionId
    });
}